// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
//
// ███╗   ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗  ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║   ██║   ██║   ██║██║     █████╗
// ██║╚██╗██║██║   ██║   ██║   ██║██║     ██╔══╝
// ██║ ╚████║╚██████╔╝   ██║   ██║╚██████╗███████╗
// ╚═╝  ╚═══╝ ╚═════╝    ╚═╝   ╚═╝ ╚═════╝╚══════╝
// ------------------------------------------------
//
// This file is automatically generated.
// Please do not edit these files manually.
//
// ------------------------------------------------

#nullable restore

using Elastic.Clients.Elasticsearch.Fluent;
using Elastic.Clients.Elasticsearch.Serialization;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text.Json;
using System.Text.Json.Serialization;

namespace Elastic.Clients.Elasticsearch.IndexManagement;

public sealed partial class SettingsSimilarityDfr : ISettingsSimilarity
{
	[JsonInclude, JsonPropertyName("after_effect")]
	public Elastic.Clients.Elasticsearch.DFRAfterEffect AfterEffect { get; set; }
	[JsonInclude, JsonPropertyName("basic_model")]
	public Elastic.Clients.Elasticsearch.DFRBasicModel BasicModel { get; set; }
	[JsonInclude, JsonPropertyName("normalization")]
	public Elastic.Clients.Elasticsearch.Normalization Normalization { get; set; }

	[JsonInclude, JsonPropertyName("type")]
	public string Type => "DFR";
}

public sealed partial class SettingsSimilarityDfrDescriptor : SerializableDescriptor<SettingsSimilarityDfrDescriptor>, IBuildableDescriptor<SettingsSimilarityDfr>
{
	internal SettingsSimilarityDfrDescriptor(Action<SettingsSimilarityDfrDescriptor> configure) => configure.Invoke(this);

	public SettingsSimilarityDfrDescriptor() : base()
	{
	}

	private Elastic.Clients.Elasticsearch.DFRAfterEffect AfterEffectValue { get; set; }
	private Elastic.Clients.Elasticsearch.DFRBasicModel BasicModelValue { get; set; }
	private Elastic.Clients.Elasticsearch.Normalization NormalizationValue { get; set; }

	public SettingsSimilarityDfrDescriptor AfterEffect(Elastic.Clients.Elasticsearch.DFRAfterEffect afterEffect)
	{
		AfterEffectValue = afterEffect;
		return Self;
	}

	public SettingsSimilarityDfrDescriptor BasicModel(Elastic.Clients.Elasticsearch.DFRBasicModel basicModel)
	{
		BasicModelValue = basicModel;
		return Self;
	}

	public SettingsSimilarityDfrDescriptor Normalization(Elastic.Clients.Elasticsearch.Normalization normalization)
	{
		NormalizationValue = normalization;
		return Self;
	}

	protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings)
	{
		writer.WriteStartObject();
		writer.WritePropertyName("after_effect");
		JsonSerializer.Serialize(writer, AfterEffectValue, options);
		writer.WritePropertyName("basic_model");
		JsonSerializer.Serialize(writer, BasicModelValue, options);
		writer.WritePropertyName("normalization");
		JsonSerializer.Serialize(writer, NormalizationValue, options);
		writer.WritePropertyName("type");
		writer.WriteStringValue("DFR");
		writer.WriteEndObject();
	}

	SettingsSimilarityDfr IBuildableDescriptor<SettingsSimilarityDfr>.Build() => new()
	{
		AfterEffect = AfterEffectValue,
		BasicModel = BasicModelValue,
		Normalization = NormalizationValue
	};
}